<?php

/**
 * hook_css_alter
 * @param type $css 
 */

function business_css_alter(&$css) {
    //make a list of module css to remove 

    $css_to_remove = array();
    $css_to_remove[] = drupal_get_path('module', 'system') . '/system.base.css';
    $css_to_remove[] = drupal_get_path('module', 'system') . '/system.messages.css';
    $css_to_remove[] = drupal_get_path('module', 'system') . '/system.theme.css';
    $css_to_remove[] = drupal_get_path('module', 'system') . '/system.base.css';
	
	unset($css[drupal_get_path('module', 'system') . '/defaults.css']);
	unset($css[drupal_get_path('module', 'system') . '/system.css']);
	unset($css[drupal_get_path('module', 'system') . '/system.menus.css']);
	unset($css[drupal_get_path('module', 'system') . '/system.theme.css']);
	unset($css[drupal_get_path('module', 'user') . '/user.css']);
	unset($css[drupal_get_path('module', 'field') . '/theme/field.css']);
	//unset($css[drupal_get_path('module', 'contextual') . '/contextual.css']);
	unset($css[drupal_get_path('module', 'node') . '/node.css']);
  
    // now we can remove the contribs from the array 
    foreach ($css_to_remove as $index => $css_file) {
        unset($css[$css_file]);
    }
}

function business_js_alter(&$js) {	
    //unset($js[drupal_get_path('module', 'misc') . '/drupal.js']);
}

function business_breadcrumb($breadcrumb) {
    if (!empty($breadcrumb)) {
        return implode(' <i class="img_breadcrumb"></i> ', $breadcrumb['breadcrumb']);
    }
}

function business_html_head_alter(&$head_elements) {
  unset($head_elements['system_meta_generator']);
  foreach ($head_elements as $key => $element) {
    if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
      unset($head_elements[$key]); 
    }
  }
}


function business_preprocess_html(&$vars) {
  global $theme_path;
  // Add conditional CSS for IE7 and below.
  drupal_add_css($theme_path . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
  $vars['head_title'] = implode(array(drupal_get_title()));  
}

function business_preprocess_page(&$vars) {   
    $vars['head_title'] = drupal_get_title() ? drupal_get_title() : variable_get('site_name', 'Mạng mua bán nhà đất sản lớn nhất Việt Nam');
}
